import { isJSON } from '@/plugins/utils'
import { EventBus } from '@/store/index'


export const formUtils = {
  methods: {
    updateInteractionData() {
      if(this.item.events.interactionData) {
        let customParams = this.item.events.interactionData.comps[0].attrs.value;
        let key = '';
        if(customParams && isJSON(customParams)) {
          key = JSON.parse(customParams).key
        }
        if(key) {
          let paperObj = {};
          paperObj[key] = this.selectedText || this.selectedValue;
          EventBus.$emit("paperData", paperObj);
        }
      }
    }
  },
}
